

<?php
require_once('../auth.php');

?>

<html>
<head>
<script language="javascript">
location.replace("newsadmin.php")

</script>
</head>
<body>
		
<?php
if(($_FILES["file"]["size"])>0)
{ 

	$img="img/";
	$img.=$_FILES["file"]["name"];
	$img2=$_FILES["file"]["name"];

	if (((1== 1)))
	{
		if ($_FILES["file"]["error"] > 0)
		{
			echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
		}
		else
		{

			if (file_exists("img/" . $_FILES["file"]["name"]))
			{
				
			}
			else
			{
				move_uploaded_file($_FILES["file"]["tmp_name"],
					"img/" . $_FILES["file"]["name"]);
				echo "Stored in: " . "img/" . $_FILES["file"]["name"];
			}
		}
	}
	else
	{
		echo "Invalid file";
	}
}
?> 




<?php
if(($_FILES["file"]["size"])>0)
{
	$new=$img2;
	include('../include.php');
	$image = new SimpleImage();
	$image->load($img);
	$image->resize(50,50);
	$image->save($new);
	
	$image->load($img);
	$image->resize(320,240);
	$image->save($img);
	

}

$date=$_POST["date"];
$head=$_POST["heading"];
$desc=$_POST["desc"];
$details=$_POST["details"];
$name=$_FILES["file"]["name"];
$con = mysql_connect("localhost","appma" ,"database");

mysql_select_db("162_appma", $con);

mysql_query("INSERT INTO  news (
`date` ,
`title` ,
`discription` ,`details` ,
`image`
)
VALUES
(
'$date',
'$head',
'$desc',
'$details',
'$name'
)");



?>



</body>
  </html>      